package com.bvgol.examples.springboot.redis.controller;/**
 * @Classname SynchronizeToAsync
 * @Description TODO
 * @Date 2021/3/5 15:36
 * @Created by GUOCHEN
 */

import com.bvgol.examples.springboot.redis.entity.SynchronizeToAsyncDto;
import com.bvgol.examples.springboot.redis.logic.LogicService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: my-spring-completely
 * @description: 同步拆异步
 * @author: GUOCHEN
 * @create: 2021/03/05 15:36
 */
@RestController
@AllArgsConstructor
public class SynchronizeToAsync {

    private LogicService logicService;

    /**
     * 功能描述:
     *
     * @param obj
     * @return: java.lang.Object
     * @author: 郭辰
     * @date: 2021/3/5 15:56
     */
    @PostMapping("push")
    public Object push(@RequestBody SynchronizeToAsyncDto obj) {
        return logicService.synchronizeToAsync(obj.getUuid(), obj.getLogicArgs());
    }

    /**
     * 功能描述:
     *
     * @param uuid
     * @return: java.lang.Object
     * @author: 郭辰
     * @date: 2021/3/5 15:56
     */
    @PostMapping("pull")
    public Object pull(@RequestBody SynchronizeToAsyncDto obj) {
        return logicService.synchronizeToAsyncResult(obj.getUuid());
    }
}
